package dontCare.gwtester.client;

import java.util.ArrayList;
import java.util.List;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.ui.RootPanel;

import dontCare.gwtester.client.gwt.Gwt;
import dontCare.gwtester.client.gwt.leakyAbstraction.ArrayOutOfBound;
import dontCare.gwtester.client.gwt.leakyAbstraction.ByteArrayToString;
import dontCare.gwtester.client.gwt.leakyAbstraction.FloatUnderflow;
import dontCare.gwtester.client.gwt.leakyAbstraction.ObjectInit;
import dontCare.gwtester.client.gwt.leakyAbstraction.RegExp;
import dontCare.gwtester.client.gwt.leakyAbstraction.TkcnDate;
import dontCare.gwtester.client.gwt.style.StyleNameTest;
import dontCare.gwtester.client.gwt.style.UiStyleTest;
import dontCare.gwtester.client.gwt.ui.AbsolutePanelTest;
import dontCare.gwtester.client.puzzlers.Album2;
import dontCare.gwtester.client.puzzlers.Album3;
import dontCare.gwtester.client.puzzlers.Album4;
import dontCare.gwtester.client.puzzlers.Album5;
import dontCare.gwtester.client.puzzlers.Album6;
import dontCare.gwtester.client.puzzlers.Album7;
import dontCare.gwtester.client.puzzlers.Album8;
import dontCare.gwtester.client.tool.TestShower;
import dontCare.gwtester.client.tool.UnitWidget;

public class GWTesterEP implements EntryPoint {
	public static final RpcServiceAsync rpc = GWT.create(RpcService.class);
	private static final ArrayList<UnitWidget> ALL_UNIT = new ArrayList<UnitWidget>();
	public static final RootPanel container = RootPanel.get("content");
	
	//在這裡掛上想顯示的 UnitWidget
	static{
		ALL_UNIT.add(new Gwt());
		ALL_UNIT.add(new AbsolutePanelTest());		
		ALL_UNIT.add(new StyleNameTest());
		ALL_UNIT.add(new UiStyleTest());

		//Puzzler
		ALL_UNIT.add(new Album2());
		ALL_UNIT.add(new Album3());
		ALL_UNIT.add(new Album4());
		ALL_UNIT.add(new Album5());
		ALL_UNIT.add(new Album6());
		ALL_UNIT.add(new Album7());
		ALL_UNIT.add(new Album8());
		
		//抽象滲漏區
		ALL_UNIT.add(new ByteArrayToString());
		ALL_UNIT.add(new ArrayOutOfBound());
		ALL_UNIT.add(new ObjectInit());
		ALL_UNIT.add(new TkcnDate());
		ALL_UNIT.add(new FloatUnderflow());
		ALL_UNIT.add(new RegExp());
	}
	
	//TODO test "return (List)list" is work fine
	public <T> List<T> getList(){
		return null;
	}
	
	@Override
	public void onModuleLoad() {
		TestShower tree = new TestShower(ALL_UNIT);
		RootPanel.get("sider").add(tree);
		RootPanel.get("mode").setVisible(!GWT.isScript());
	}
}